package net.zjitc.securityloginapi.service.impl;

import jakarta.annotation.Resource;
import net.zjitc.securityloginapi.mapper.TPermissionMapper;
import net.zjitc.securityloginapi.mapper.TUserDao;
import net.zjitc.securityloginapi.pojo.TPermission;
import net.zjitc.securityloginapi.pojo.TUser;
import net.zjitc.securityloginapi.service.UserService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 罗翼侨
 * @date 2025/3/4 9:59
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private TUserDao tUserDao;
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        TUser tUser = tUserDao.selectByLoginAct(username);
        if(tUser == null){
            throw new UsernameNotFoundException("用户不存在");
        }
        return tUser;
    }
}
